﻿//********************************************************************************//
//创建日期：<创建日期，2010-08-02>
//创建作者：<王一飞，wangyifei@shanghai3h.com>
//功能说明：YS_SF_SHOUFEI实体层次
//********************************************************************************//

#region Entity

using System;
using System.Data;
using Entity;
using Oracle.DataAccess.Client;
using Platform.Configuration;
using Platform.Data;

namespace Entity
{
    [Serializable]
    public class YS_SF_SHOUFEI
    {
        private double? m_db_n_chae;

        private double? m_db_n_zongjine;

        private decimal? m_dec_i_daozhangbz;

        private decimal? m_dec_i_hezhangbz;

        private decimal? m_dec_i_jlzt;

        private decimal? m_dec_i_shoufeibh;

        private decimal? m_dec_i_shoufeir;

        private decimal? m_dec_i_type;

        private decimal? m_dec_i_zongbis;

        private decimal m_dec_id;

        private DateTime? m_DT_d_caozuosj;

        private DateTime? m_DT_d_chuanpiaorq;

        private DateTime? m_DT_d_daozhangrq;

        private DateTime? m_DT_d_hezhangrq;

        private string m_str_s_beiyong1;

        private string m_str_s_beiyong2;

        private string m_str_s_beiyong3;

        private string m_str_s_caozuor;

        private string m_str_s_chuanpiaobh;

        private string m_str_s_guanlikbh;

        private string m_str_s_zhangwuny;

        /// <summary>
        ///     主键
        /// </summary>
        public decimal ID
        {
            get { return m_dec_id; }
            set { m_dec_id = value; }
        }

        /// <summary>
        ///     收费编号
        /// </summary>
        public decimal? I_SHOUFEIBH
        {
            get { return m_dec_i_shoufeibh; }
            set { m_dec_i_shoufeibh = value; }
        }

        /// <summary>
        ///     总金额
        /// </summary>
        public double? N_ZONGJINE
        {
            get { return m_db_n_zongjine; }
            set { m_db_n_zongjine = value; }
        }

        /// <summary>
        ///     总笔数
        /// </summary>
        public decimal? I_ZONGBIS
        {
            get { return m_dec_i_zongbis; }
            set { m_dec_i_zongbis = value; }
        }

        /// <summary>
        ///     差额
        /// </summary>
        public double? N_CHAE
        {
            get { return m_db_n_chae; }
            set { m_db_n_chae = value; }
        }

        /// <summary>
        ///     收费类型
        /// </summary>
        public decimal? I_TYPE
        {
            get { return m_dec_i_type; }
            set { m_dec_i_type = value; }
        }

        /// <summary>
        ///     核账标志
        /// </summary>
        public decimal? I_HEZHANGBZ
        {
            get { return m_dec_i_hezhangbz; }
            set { m_dec_i_hezhangbz = value; }
        }

        /// <summary>
        ///     核账日期
        /// </summary>
        public DateTime? D_HEZHANGRQ
        {
            get { return m_DT_d_hezhangrq; }
            set { m_DT_d_hezhangrq = value; }
        }

        /// <summary>
        ///     到账标志
        /// </summary>
        public decimal? I_DAOZHANGBZ
        {
            get { return m_dec_i_daozhangbz; }
            set { m_dec_i_daozhangbz = value; }
        }

        /// <summary>
        ///     到账日期
        /// </summary>
        public DateTime? D_DAOZHANGRQ
        {
            get { return m_DT_d_daozhangrq; }
            set { m_DT_d_daozhangrq = value; }
        }

        /// <summary>
        ///     传票日期
        /// </summary>
        public DateTime? D_CHUANPIAORQ
        {
            get { return m_DT_d_chuanpiaorq; }
            set { m_DT_d_chuanpiaorq = value; }
        }

        /// <summary>
        ///     传票编号
        /// </summary>
        public string S_CHUANPIAOBH
        {
            get { return m_str_s_chuanpiaobh; }
            set { m_str_s_chuanpiaobh = value; }
        }

        /// <summary>
        ///     账务年月
        /// </summary>
        public string S_ZHANGWUNY
        {
            get { return m_str_s_zhangwuny; }
            set { m_str_s_zhangwuny = value; }
        }

        /// <summary>
        ///     收费人
        /// </summary>
        public decimal? I_SHOUFEIR
        {
            get { return m_dec_i_shoufeir; }
            set { m_dec_i_shoufeir = value; }
        }

        /// <summary>
        ///     管理块号
        /// </summary>
        public string S_GUANLIKBH
        {
            get { return m_str_s_guanlikbh; }
            set { m_str_s_guanlikbh = value; }
        }

        /// <summary>
        ///     0:正常 -1:删除
        /// </summary>
        public decimal? I_JLZT
        {
            get { return m_dec_i_jlzt; }
            set { m_dec_i_jlzt = value; }
        }

        /// <summary>
        /// </summary>
        public string S_BEIYONG1
        {
            get { return m_str_s_beiyong1; }
            set { m_str_s_beiyong1 = value; }
        }

        /// <summary>
        /// </summary>
        public string S_BEIYONG2
        {
            get { return m_str_s_beiyong2; }
            set { m_str_s_beiyong2 = value; }
        }

        /// <summary>
        /// </summary>
        public string S_BEIYONG3
        {
            get { return m_str_s_beiyong3; }
            set { m_str_s_beiyong3 = value; }
        }

        /// <summary>
        ///     操作人
        /// </summary>
        public string S_CAOZUOR
        {
            get { return m_str_s_caozuor; }
            set { m_str_s_caozuor = value; }
        }

        /// <summary>
        ///     操作时间
        /// </summary>
        public DateTime? D_CAOZUOSJ
        {
            get { return m_DT_d_caozuosj; }
            set { m_DT_d_caozuosj = value; }
        }
    }
}

#endregion

#region EntityProcess

namespace BLL.Access
{
    //using System.Data.OracleClient;

    public class YS_SF_SHOUFEIProcess
    {
        #region Field

        protected string conn;

        #endregion

        #region Construction

        public YS_SF_SHOUFEIProcess()
        {
            conn = ConfigHelper.PlatformConnString;
        }

        #endregion

        #region public

        /// <summary>
        ///     根据YS_SF_SHOUFEI实体添加或者修改YS_SF_SHOUFEI信息
        /// </summary>
        public bool InsertOrUpdate(YS_SF_SHOUFEI YS_SF_SHOUFEI, OracleTransaction Transaction)
        {
            if (YS_SF_SHOUFEI.ID == 0)
                InsertYS_SF_SHOUFEI(YS_SF_SHOUFEI, Transaction);
            else
                UpdateYS_SF_SHOUFEI(YS_SF_SHOUFEI, Transaction);
            return YS_SF_SHOUFEI.ID == 0 ? false : true;
        }

        /// <summary>
        ///     根据YS_SF_SHOUFEI实体添加或修改YS_SF_SHOUFEI信息
        /// </summary>
        public bool InsertOrUpdate(YS_SF_SHOUFEI YS_SF_SHOUFEI)
        {
            return InsertOrUpdate(YS_SF_SHOUFEI, null);
        }


        /// <summary>
        ///     根据YS_SF_SHOUFEI主键删除YS_SF_SHOUFEI信息
        /// </summary>
        /// <param name="ID"></param>
        public bool DeleteYS_SF_SHOUFEI(decimal ID, OracleTransaction Transaction)
        {
            var spName = "CS_DelYS_SF_SHOUFEI";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = ID;
            var result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery(Transaction, CommandType.StoredProcedure, spName, storedParams);
            return result == 0 ? false : true;
        }

        /// <summary>
        ///     根据YS_SF_SHOUFEI主键删除YS_SF_SHOUFEI信息
        /// </summary>
        /// <param name="ID"></param>
        public bool DeleteYS_SF_SHOUFEI(decimal ID)
        {
            return DeleteYS_SF_SHOUFEI(ID, null);
        }

        /// <summary>
        ///     根据条件删除YS_SF_SHOUFEI信息
        /// </summary>
        /// <param name="WhereClause">条件子句(Oracle语句)不带where</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>如果删除成功，返回true,否则返回fals</returns>
        public bool DeleteYS_SF_SHOUFEIsDynamic(string WhereClause, OracleTransaction Transaction)
        {
            var spName = "CS_DelYS_SF_SHOUFEIsDyn";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = WhereClause;
            var result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery(Transaction, CommandType.StoredProcedure, spName, storedParams);
            return result == 0 ? false : true;
        }

        /// <summary>
        ///     根据条件删除YS_SF_SHOUFEI信息
        /// </summary>
        /// <param name="WhereClause">条件子句(Oracle语句)不带where</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>如果删除成功，返回true,否则返回fals</returns>
        public bool DeleteYS_SF_SHOUFEIsDynamic(string WhereClause)
        {
            return DeleteYS_SF_SHOUFEIsDynamic(WhereClause, null);
        }

        /// <summary>
        ///     根据YS_SF_SHOUFEI主键选择YS_SF_SHOUFEI信息
        /// </summary>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>YS_SF_SHOUFEI信息</returns>
        public YS_SF_SHOUFEI SelectYS_SF_SHOUFEI(decimal ID, OracleTransaction Transaction)
        {
            var spName = "CS_SelYS_SF_SHOUFEI";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = ID;
            OracleDataReader rd;
            if (Transaction == null)
                rd = OracleHelper.ExecuteReader(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                rd = OracleHelper.ExecuteReader(Transaction, CommandType.StoredProcedure, spName, storedParams);
            if (rd.Read())
            {
                var YS_SF_SHOUFEI = PopulateYS_SF_SHOUFEI(rd);
                rd.Close();
                return YS_SF_SHOUFEI;
            }
            return null;
        }

        /// <summary>
        ///     根据YS_SF_SHOUFEI主键选择YS_SF_SHOUFEI信息
        /// </summary>
        /// <returns>YS_SF_SHOUFEI信息</returns>
        public YS_SF_SHOUFEI SelectYS_SF_SHOUFEI(decimal ID)
        {
            return SelectYS_SF_SHOUFEI(ID, null);
        }

        /// <summary>
        ///     选择所有YS_SF_SHOUFEI信息
        /// </summary>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>所有YS_SF_SHOUFEI信息</returns>
        public DataTable SelectYS_SF_SHOUFEIsAll(OracleTransaction Transaction)
        {
            var spName = "CS_SelYS_SF_SHOUFEIsAll";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            DataSet ds = null;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                ds = OracleHelper.ExecuteDataset(Transaction, CommandType.StoredProcedure, spName, storedParams);
            if (ds != null && ds.Tables.Count > 0)
            {
                AddRowNumber(ds.Tables[0]);
                return ds.Tables[0];
            }
            return null;
        }

        /// <summary>
        ///     选择所有YS_SF_SHOUFEI信息
        /// </summary>
        /// <returns>所有YS_SF_SHOUFEI信息</returns>
        public DataTable SelectYS_SF_SHOUFEIsAll()
        {
            return SelectYS_SF_SHOUFEIsAll(null);
        }

        /// <summary>
        ///     根据条件选择YS_SF_SHOUFEI信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>YS_SF_SHOUFEI信息</returns>
        public DataTable SelectYS_SF_SHOUFEIsDynamic(string WhereClause, string OrderByExpression,
            OracleTransaction Transaction)
        {
            var spName = "CS_SelYS_SF_SHOUFEIsDyn";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = string.IsNullOrEmpty(WhereClause.Trim()) ? "1=1" : WhereClause;
            storedParams[1].Value = OrderByExpression;
            DataSet ds = null;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                ds = OracleHelper.ExecuteDataset(Transaction, CommandType.StoredProcedure, spName, storedParams);
            if (ds != null && ds.Tables.Count > 0)
            {
                AddRowNumber(ds.Tables[0]);
                return ds.Tables[0];
            }
            return null;
        }


        /// <summary>
        ///     根据条件选择YS_SF_SHOUFEI信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <returns>YS_SF_SHOUFEI信息</returns>
        public DataTable SelectYS_SF_SHOUFEIsDynamic(string WhereClause, string OrderByExpression)
        {
            return SelectYS_SF_SHOUFEIsDynamic(WhereClause, OrderByExpression, null);
        }


        /// <summary>
        ///     根据条件选择YS_SF_SHOUFEI信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <param name="PageIndex">页码</param>
        /// <param name="PageSize">页数</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>YS_SF_SHOUFEI信息</returns>
        public DataTable SelectYS_SF_SHOUFEIsDynamic(string WhereClause, string OrderByExpression, int PageIndex,
            int PageSize, OracleTransaction Transaction)
        {
            var spName = "CS_SelYS_SF_SHOUFEIsDynPaged";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = string.IsNullOrEmpty(WhereClause.Trim()) ? "1=1" : WhereClause;
            storedParams[1].Value = OrderByExpression;
            storedParams[2].Value = PageIndex;
            storedParams[3].Value = PageSize;
            DataSet ds = null;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                ds = OracleHelper.ExecuteDataset(Transaction, CommandType.StoredProcedure, spName, storedParams);
            if (ds != null && ds.Tables.Count > 0)
            {
                AddRowNumber(ds.Tables[0]);
                return ds.Tables[0];
            }
            return null;
        }


        /// <summary>
        ///     根据条件选择YS_SF_SHOUFEI信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <param name="PageIndex">页码</param>
        /// <param name="PageSize">页数</param>
        /// <returns>YS_SF_SHOUFEI信息</returns>
        public DataTable SelectYS_SF_SHOUFEIsDynamic(string WhereClause, string OrderByExpression, int PageIndex,
            int PageSize)
        {
            return SelectYS_SF_SHOUFEIsDynamic(WhereClause, OrderByExpression, PageIndex, PageSize, null);
        }

        /// <summary>
        ///     根据条件更新YS_SF_SHOUFEI字段
        /// </summary>
        /// <returns>受影响行数</returns>
        public int UpdateYS_SF_SHOUFEIsDynamic(string UpdateValue, string WhereClause, OracleTransaction Transaction)
        {
            var result = 0;
            if (UpdateValue == "" || WhereClause == "")
                return 0;
            var spName = "CS_UpdYS_SF_SHOUFEIDyn";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            DataSet ds = null;
            storedParams[0].Value = UpdateValue;
            storedParams[1].Value = WhereClause;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                ds = OracleHelper.ExecuteDataset(Transaction, CommandType.StoredProcedure, spName, storedParams);
            result = Convert.ToInt32(storedParams[2].Value);
            return result;
        }

        /// <summary>
        ///     根据条件更新YS_SF_SHOUFEI字段
        /// </summary>
        /// <returns>受影响行数</returns>
        public int UpdateYS_SF_SHOUFEIsDynamic(string UpdateValue, string WhereClause)
        {
            return UpdateYS_SF_SHOUFEIsDynamic(UpdateValue, WhereClause, null);
        }

        #endregion

        #region Private

        private int InsertYS_SF_SHOUFEI(YS_SF_SHOUFEI YS_SF_SHOUFEI, OracleTransaction Transaction)
        {
            var spName = "CS_InsYS_SF_SHOUFEI";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = YS_SF_SHOUFEI.I_SHOUFEIBH;
            storedParams[1].Value = YS_SF_SHOUFEI.N_ZONGJINE;
            storedParams[2].Value = YS_SF_SHOUFEI.I_ZONGBIS;
            storedParams[3].Value = YS_SF_SHOUFEI.N_CHAE;
            storedParams[4].Value = YS_SF_SHOUFEI.I_TYPE;
            storedParams[5].Value = YS_SF_SHOUFEI.I_HEZHANGBZ;
            storedParams[6].Value = YS_SF_SHOUFEI.D_HEZHANGRQ;
            storedParams[7].Value = YS_SF_SHOUFEI.I_DAOZHANGBZ;
            storedParams[8].Value = YS_SF_SHOUFEI.D_DAOZHANGRQ;
            storedParams[9].Value = YS_SF_SHOUFEI.D_CHUANPIAORQ;
            storedParams[10].Value = YS_SF_SHOUFEI.S_CHUANPIAOBH;
            storedParams[11].Value = YS_SF_SHOUFEI.S_ZHANGWUNY;
            storedParams[12].Value = YS_SF_SHOUFEI.I_SHOUFEIR;
            storedParams[13].Value = YS_SF_SHOUFEI.S_GUANLIKBH;
            storedParams[14].Value = YS_SF_SHOUFEI.I_JLZT;
            storedParams[15].Value = YS_SF_SHOUFEI.S_BEIYONG1;
            storedParams[16].Value = YS_SF_SHOUFEI.S_BEIYONG2;
            storedParams[17].Value = YS_SF_SHOUFEI.S_BEIYONG3;
            storedParams[18].Value = YS_SF_SHOUFEI.S_CAOZUOR;
            storedParams[19].Value = YS_SF_SHOUFEI.D_CAOZUOSJ;
            var result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery(Transaction, CommandType.StoredProcedure, spName, storedParams);
            YS_SF_SHOUFEI.ID = Convert.ToInt32(storedParams[20].Value);
            return result;
        }

        private bool UpdateYS_SF_SHOUFEI(YS_SF_SHOUFEI YS_SF_SHOUFEI, OracleTransaction Transaction)
        {
            var spName = "CS_UpdYS_SF_SHOUFEI";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = YS_SF_SHOUFEI.I_SHOUFEIBH;
            storedParams[1].Value = YS_SF_SHOUFEI.N_ZONGJINE;
            storedParams[2].Value = YS_SF_SHOUFEI.I_ZONGBIS;
            storedParams[3].Value = YS_SF_SHOUFEI.N_CHAE;
            storedParams[4].Value = YS_SF_SHOUFEI.I_TYPE;
            storedParams[5].Value = YS_SF_SHOUFEI.I_HEZHANGBZ;
            storedParams[6].Value = YS_SF_SHOUFEI.D_HEZHANGRQ;
            storedParams[7].Value = YS_SF_SHOUFEI.I_DAOZHANGBZ;
            storedParams[8].Value = YS_SF_SHOUFEI.D_DAOZHANGRQ;
            storedParams[9].Value = YS_SF_SHOUFEI.D_CHUANPIAORQ;
            storedParams[10].Value = YS_SF_SHOUFEI.S_CHUANPIAOBH;
            storedParams[11].Value = YS_SF_SHOUFEI.S_ZHANGWUNY;
            storedParams[12].Value = YS_SF_SHOUFEI.I_SHOUFEIR;
            storedParams[13].Value = YS_SF_SHOUFEI.S_GUANLIKBH;
            storedParams[14].Value = YS_SF_SHOUFEI.I_JLZT;
            storedParams[15].Value = YS_SF_SHOUFEI.S_BEIYONG1;
            storedParams[16].Value = YS_SF_SHOUFEI.S_BEIYONG2;
            storedParams[17].Value = YS_SF_SHOUFEI.S_BEIYONG3;
            storedParams[18].Value = YS_SF_SHOUFEI.S_CAOZUOR;
            storedParams[19].Value = YS_SF_SHOUFEI.D_CAOZUOSJ;
            storedParams[20].Value = YS_SF_SHOUFEI.ID;
            var result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery(Transaction, CommandType.StoredProcedure, spName, storedParams);
            return result == 0 ? false : true;
        }


        private YS_SF_SHOUFEI PopulateYS_SF_SHOUFEI(IDataReader dr)
        {
            var YS_SF_SHOUFEI = new YS_SF_SHOUFEI();
            YS_SF_SHOUFEI.ID = dr["ID"] == DBNull.Value ? 0 : (decimal) dr["ID"];
            YS_SF_SHOUFEI.I_SHOUFEIBH = dr["I_SHOUFEIBH"] == DBNull.Value ? null : (decimal?) dr["I_SHOUFEIBH"];
            YS_SF_SHOUFEI.N_ZONGJINE = dr["N_ZONGJINE"] == DBNull.Value ? null : (double?) dr["N_ZONGJINE"];
            YS_SF_SHOUFEI.I_ZONGBIS = dr["I_ZONGBIS"] == DBNull.Value ? null : (decimal?) dr["I_ZONGBIS"];
            YS_SF_SHOUFEI.N_CHAE = dr["N_CHAE"] == DBNull.Value ? null : (double?) dr["N_CHAE"];
            YS_SF_SHOUFEI.I_TYPE = dr["I_TYPE"] == DBNull.Value ? null : (decimal?) dr["I_TYPE"];
            YS_SF_SHOUFEI.I_HEZHANGBZ = dr["I_HEZHANGBZ"] == DBNull.Value ? null : (decimal?) dr["I_HEZHANGBZ"];
            YS_SF_SHOUFEI.D_HEZHANGRQ = dr["D_HEZHANGRQ"] == DBNull.Value ? null : (DateTime?) dr["D_HEZHANGRQ"];
            YS_SF_SHOUFEI.I_DAOZHANGBZ = dr["I_DAOZHANGBZ"] == DBNull.Value ? null : (decimal?) dr["I_DAOZHANGBZ"];
            YS_SF_SHOUFEI.D_DAOZHANGRQ = dr["D_DAOZHANGRQ"] == DBNull.Value ? null : (DateTime?) dr["D_DAOZHANGRQ"];
            YS_SF_SHOUFEI.D_CHUANPIAORQ = dr["D_CHUANPIAORQ"] == DBNull.Value ? null : (DateTime?) dr["D_CHUANPIAORQ"];
            YS_SF_SHOUFEI.S_CHUANPIAOBH = dr["S_CHUANPIAOBH"] == DBNull.Value ? null : (string) dr["S_CHUANPIAOBH"];
            YS_SF_SHOUFEI.S_ZHANGWUNY = dr["S_ZHANGWUNY"] == DBNull.Value ? null : (string) dr["S_ZHANGWUNY"];
            YS_SF_SHOUFEI.I_SHOUFEIR = dr["I_SHOUFEIR"] == DBNull.Value ? null : (decimal?) dr["I_SHOUFEIR"];
            YS_SF_SHOUFEI.S_GUANLIKBH = dr["S_GUANLIKBH"] == DBNull.Value ? null : (string) dr["S_GUANLIKBH"];
            YS_SF_SHOUFEI.I_JLZT = dr["I_JLZT"] == DBNull.Value ? null : (decimal?) dr["I_JLZT"];
            YS_SF_SHOUFEI.S_BEIYONG1 = dr["S_BEIYONG1"] == DBNull.Value ? null : (string) dr["S_BEIYONG1"];
            YS_SF_SHOUFEI.S_BEIYONG2 = dr["S_BEIYONG2"] == DBNull.Value ? null : (string) dr["S_BEIYONG2"];
            YS_SF_SHOUFEI.S_BEIYONG3 = dr["S_BEIYONG3"] == DBNull.Value ? null : (string) dr["S_BEIYONG3"];
            YS_SF_SHOUFEI.S_CAOZUOR = dr["S_CAOZUOR"] == DBNull.Value ? null : (string) dr["S_CAOZUOR"];
            YS_SF_SHOUFEI.D_CAOZUOSJ = dr["D_CAOZUOSJ"] == DBNull.Value ? null : (DateTime?) dr["D_CAOZUOSJ"];
            return YS_SF_SHOUFEI;
        }


        private void AddRowNumber(DataTable dt)
        {
            dt.Columns.Add(new DataColumn("RowNumber", typeof(int)));
            for (var i = 0; i < dt.Rows.Count; i++)
                dt.Rows[i][dt.Columns.Count - 1] = i + 1;
        }

        #endregion
    }
}

#endregion